package cluster;

import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.MongoClient;

public class MyMongoTest {
	public static void main(String[] args) throws Exception {
		// 集群模式跟单机模式差不多，就是连接集群的mogos
		// 而mogos就是连接到集群的配置服务器获取到相应的分片节点

		MongoClient mongo = new MongoClient(" 10.1.10.80", 27017);

		DB db = mongo.getDB("mydb");

		DBCollection users = db.getCollection("tuser");

		BasicDBObject d1 = new BasicDBObject();
		d1.put("uname", "myU12");
		d1.append("userId", "myU2").append("name", "updatename222");
		users.insert(d1);

		mongo.close();

	}
}
